using System;
using System.Collections;
using Rdl;

namespace GTame.ReportParser
{

    public class DataSourceType
    {

        private GTame.ReportParser.ConnectionPropertiesType _ConnectionProperties;
        private string _DataSourceReference;
        private System.Nullable<bool> _Transaction;
        private string nameField;

        public GTame.ReportParser.ConnectionPropertiesType ConnectionProperties
        {
            get
            {
                if (_ConnectionProperties == null)
                    _ConnectionProperties = new GTame.ReportParser.ConnectionPropertiesType();
                return _ConnectionProperties;
            }
            set
            {
                _ConnectionProperties = value;
            }
        }

        public string DataSourceReference
        {
            get
            {
                return _DataSourceReference;
            }
            set
            {
                _DataSourceReference = value;
            }
        }

        public string Name
        {
            get
            {
                return nameField;
            }
            set
            {
                nameField = value;
            }
        }

        public System.Nullable<bool> Transaction
        {
            get
            {
                return _Transaction;
            }
            set
            {
                _Transaction = value;
            }
        }

        public DataSourceType()
        {
            _Transaction = new System.Nullable<bool>[]();
        }

        public Rdl.DataSourceType Write()
        {
            Rdl.DataSourceType dataSourceType = new Rdl.DataSourceType();
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            dataSourceType.Name = nameField;
            if (_ConnectionProperties != null)
                arrayList.Add(_ConnectionProperties.Write());
            if (_DataSourceReference != null)
                arrayList.Add(_DataSourceReference);
            if (_Transaction.get_HasValue())
                arrayList.Add(_Transaction);
            dataSourceType.Items = arrayList.ToArray();
            arrayList = null;
            return dataSourceType;
        }

    } // class DataSourceType

}

